<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="/static/css/login.css"/>
    <title>首页</title>
	<script src="/static/js/jquery-3.2.1.min.js"></script>
	<script src="/static/js/common.js"></script>
    <script src="/static/js/login.js"></script>
	<script>
		$(function(){
			$("#loginbtn").click(function(){
				let username = $("#user_name").val();
				if(username == undefined || username == ""){
					$("#errorMsg").html('用户名不能为空');
					return;
				}
				let password = $("#pass_word").val();
				if(password == undefined || password == ""){
					$("#errorMsg").html('密码不能为空');
					return;
				}
				$("#login_form").submit();
			})
		})
	</script>
</head>
<body>
	<!-- 导航界面 -->
	<nav>
		<div class="nav">
			<span class="lf">终于等到你</span>
			<span class="rt">爱下载资源分享平台</span>
		</div>
	</nav>

	<!-- 登录面板 -->
	<section class="main">
		<div class="login-type">
			<a class="checked" name="login-pwd">密码登录</a><a name="login-sms">短信码登录</a>
		</div>
		
		<form class="login-pwd login-panel" autocomplete="off" id="login_form" action="{% url 'xzblogin' %}" method="post">
			<div id="errorMsg">{{ errorMsg }} {{ success }}</div>
			{% csrf_token %}
			<input type="text" name="username" id="user_name" class="inp user" placeholder="账号/邮箱/手机号"/>
			<input type="password" name="password" id="pass_word" class="inp pwd" placeholder="密码"/>
			<!-- 处理密码眼睛 -->
			<span class="eye clos"></span>
			
			<div class="re">
				<input type="checkbox" name="remember_me" id="remember_me"/>
				<label for="remember_me">下次自动登录</label>
				<a class="find-pass" href="{% url 'xzbfindpass' %}">忘记密码，立即找回</a>
			</div>
			
			<input type="button" id="loginbtn" value="登录">
			
			<a href="{% url 'xzbregister' %}" class="regist">没有账号？立即注册</a>
			
			
		</form>
		
		<form class="login-sms login-panel" autocomplete="off">
			<input type="text" name="tel" class="inp tel" placeholder="手机号"/>
			<input type="code" name="code" class="inp code" placeholder="验证码"/>
			<span class="btn-code">获取验证码</span>
			
			<div class="re">
				<input type="checkbox" name="remember-me" id="remember"/>
				<label for="remember">下次自动登录</label>
			</div>
			
			<a class="log-btn">登录</a>
			
			<a href="{% url 'xzbregister' %}" class="regist">没有账号？立即注册</a>
			
		</form>
		
		<div class="third">
			<span class="lf"></span>第三方登录<span class="rf"></span>	
		</div>
		
		<p class="third">
			<a class="zfb"><span>支付宝</span></a>
			<a class="wx"><span>微信</span></a>
			<a class="qq"><span>QQ</span></a>
		</p>
		
	</section>
	
	<footer>
		<p class="decro">本站所有资源信息均由网友上传,本站只是为了推广资源让更多读者下载,使用。如涉侵权，请联系管理员</p>
		<p class="cr">Copyright © 2021-2025 <span class="site">爱下载资源分享平台</span> All Rights Reserved.</p>
		<p class="num">沪ICP备14048333号</p>
	</footer>
	<script>
		$(function(){
			// 记住密码，自动登录
			let rememberme = '{{ request.COOKIES.rememberme }}'
			if(rememberme){
				$('#user_name').val('{{ request.COOKIES.username }}');
				$('#pass_word').val('{{ request.COOKIES.password }}');
				$('#remember_me').prop("checked", true);
<!--				$('#login_form').submit();-->
			}
		})
	</script>
</body>

</html>